include? clone cl:topfile

anew task-App2.f


0 .if

	This program is useful for testing overlay CLONEing code
	in that it causes CLONE to deal with forward-referencing
	while tracing CFAs.

.then


\ : GetA5   ( -- up )   up@ ;

:struct TestStruct
	long	long1
	long	long2
;struct

TestStruct TStruct

$ 12345678 Tstruct ..! long1
$ 87654321 Tstruct ..! long2

: addme  + ;

: Someword   ( -- . just something to call, does nothing )
  4 5 + dup addme
;

: .absup   ." A5 (abs) = "  up@ >abs .hex cr ;

: .relup   ." A5 (rel) = "  up@      .hex cr ;

: .Tstruct ." Tstruct  = "  Tstruct .hex cr
           ." long1    = "  Tstruct dup .. long1 .hex
                            ." /" ..@ long1 .hex cr
           ." long2    = "  Tstruct dup .. long2 .hex
                            ." /" ..@ long2 .hex cr
;

: .startword
  up@ cell-  @
  cr       ." Overlay exec 'A5-relative-CFA' is A5+"  .hex
  cr ." 1st 32 bytes of overlay area:"  up@ cell- $ 20 dump >newline
;

: .Overlay  ( -- )
  Someword
  >newline
  .absup
  .relup
  .Tstruct
  .startword
;

MakeOverlay .Overlay

: App2  ( -- )
  .Overlay
  ' .Overlay FreeOverlay
;


